import mechanize

class Agent(object):

  def __init__(self, name):
    self.name = name
       
  def checkLoop(self, previous_links):
    return len(previous_links)==len(set(previous_links))
  
  def getBrowser(self):
    cookies = mechanize.CookieJar()
    opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
    opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
    mechanize.install_opener(opener)
    br = mechanize.Browser()
    return br
  
  def Connect(self):
    print "Agent.Connect()"
    
  def Collect(self):
    print "Agent.Collect()"

